import { createRouter, createWebHistory } from 'vue-router'

export const erji = [
  {
    path: '/home',
    name: 'home',
    meta: {
      title: '首页'
    },
    component: () => import('../views/home/index.vue'),
  },
  {
    path: '/lite',
    name: 'lite',
    meta: {
      title: '更多'
    },
    component: () => import('../views/home/index.vue'),
    children: [
      {
        path: '/lite/kf',
        name: 'kf',
        meta: {
          title: '客服聊天'
        },
        component: () => import('../views/kf/index.vue'),
      },
      {
        path: '/lite/gd',
        name: 'gd',
        meta: {
          title: '高德地图'
        },
        component: () => import('../views/gd/index.vue'),
      },
    ]
  },
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path:'/',
      redirect:'/layout'
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/login/index.vue'),
    },
    {
      path: '/layout',
      name: 'layout',
      component: () => import('../views/layout/index.vue'),
      children:erji
    },
    {
      path: '/403',
      name: '403',
      component: () => import('../views/403/index.vue'),
    },
    {
      path: '/404',
      name: '404',
      component: () => import('../views/404/index.vue'),
    },
  ],
})

export default router
